package com.hivekion.system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hivekion.system.domain.dto.member.SysMemberModifyDto;
import com.hivekion.system.domain.dto.member.SysMemberPageQuery;
import com.hivekion.system.domain.dto.member.SysMemberSaveDto;
import com.hivekion.system.domain.vo.member.SysMemberPageVo;
import com.hivekion.system.domain.vo.member.SysMemberVo;
import com.hivekion.system.service.ISysMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/system/member")
public class SysMemberController {

    @Autowired
    ISysMemberService memberService;

    @GetMapping("/page")
    public Page<SysMemberPageVo> page(SysMemberPageQuery query) {
        return memberService.getPage(query);
    }

    @PostMapping("/save")
    public boolean save(@RequestBody SysMemberSaveDto dto) {
        return memberService.saveDto(dto);
    }

    @GetMapping("/detail")
    public SysMemberVo detail(String id) {
        return memberService.getDetail(id);
    }

    @PutMapping("/modify")
    public boolean save(@RequestBody SysMemberModifyDto dto) {
        return memberService.modifyDto(dto);
    }

    @DeleteMapping("/remove")
    public boolean remove(String id) {
        return memberService.removeById(id);
    }
}
